home *** CD-ROM | disk | FTP | other *** search
/ Risc World 9 / Risc World 9.iso / Software / Issue1 / Wolf3D.ZIP / Extras / Tech Info / Map Info < prev    next >
Text File  |  1999-11-07  |  8KB  |  199 lines

  1. Wolfenstein 3D Map Formats
  2. --------------------------
  3.  
  4. This document contains the formats of the MAPHEAD and GAMEMAPS file, which
  5. together define the maps for Wolfenstein 3D.  The file format is valid for
  6. versions of PC Wolfenstein 3D greater than V1.4 and for V1.0 of the RISC OS
  7. version.
  8.  
  9. MAPHEAD:
  10.  
  11. +0 - &CD
  12. +1 - &AB
  13. +2 - file pointer (in GAMEMAPS) of map descriptor for level 1
  14. +6 - file pointer of map descriptor for level 2
  15. +2 + 4*(n-1) - file pointer of map descriptor for level 3
  16.  
  17. So you extract the word from 2 + 4n where n is from 0 to 59 and that is an
  18. offset into the GAMEMAPS file from which you must load 18 bytes.  (Note that
  19. if the value is 0 this means that the level is not available.)  These 18
  20. bytes (the map descriptor) are:
  21.  
  22. +0 - File pointer to map plane 1 (in GAMEMAPS)
  23. +4 - File pointer to map plane 2
  24. +8 - File pointer to map plane 3
  25. +12 - Length of map plane 1 data
  26. +14 - Length of map plane 2 data
  27. +16 - Length of map plane 3 data
  28.  
  29. This requires a little explanation - each map plane contains 64x64 cells (the
  30. size of the map).  Map plane 1 contains the walls, floors and doors.  Map
  31. plane 2 contains the objects, actors, and various markers.  Map plane 3 is
  32. always filled with 0s.  Each cell is two bytes, so each map plane is 8K long
  33. when uncompressed.  Sadly, they are compressed, so you'll need to decompress
  34. them.  In Appendix I is an assembler-language code fragment to decompress a 
  35. lump.       
  36.                                       
  37.  
  38. Now you have 3 decompressed lumps you can look at and edit them.  As mentioned
  39. earlier, the first plane contains the walls, doors and floors.  Each value is
  40. two bytes, but for walls these are limited to:
  41.  
  42. 0 = nothingness - should never occur
  43. 1 to 49 = wall type n
  44. &5A/&5B = vertical/horizontal door
  45. &5C/&5D = vertical/horizontal door needing yellow key
  46. &5E/&5F = vertical/horizontal door needing blue key
  47. &64/&65 = elevator door
  48. &6A     = floor type 0
  49. &6B onwards = floor type n - &6A
  50.  
  51. Wall types each have 2 bitmaps in the ASWAP file.  The first two graphics in
  52. the ASWAP file are for wall #1.  The first frame is brighter than the second
  53. frame; this is used to express a little subtle lighting by plotting one frame
  54. on N/S wall faces and the other one on E/W faces.
  55.  
  56. Floor types go from 1 to 40 for normal floors and 0 for a 'silent' floor.  If
  57. a soldier starts on a 'silent' floor tile then he will not hear anything, and
  58. will only 'wake up' when he actually sees the player.  Experiment!
  59.  
  60. The object types use 9 bits of the value.  The other 7 bits must be 0.  (While
  61. I'm on, the top 8 bits of each wall value must be 0).
  62.  
  63. The mapping goes as follows:
  64.  
  65. &00 : no object
  66. &01 - &12 : undefined, DO NOT USE
  67. &13 : player start, facing N
  68. &14 : player start, facing E
  69. &15 : player start, facing S
  70. &16 : player start, facing W
  71. &17 : Object #2
  72. &18 : Object #3
  73. &19 - &46 : Object #(n-&15)
  74. &47 - &59 : undefined, DO NOT USE
  75. &5A - &61 : Turn tiles 0 to 7
  76. &62 : Secret Door
  77. &63 : End of game
  78. &64 - &6B : undefined, DO NOT USE
  79.  
  80. &6C onwards are actors, which I will explain in a minute.  Firstly, though,
  81. objects #2 to #49 are the static objects.  Some you can walk through and some
  82. you can't.  The graphics are in the ASWAP file.  Object #0 is actually the 
  83. "DEMO" sign and object #1 is the "DEATHCAM" sign - these are not true objects.
  84. The first object which can appear on a map is Object #2 - the pool of water.
  85.  
  86. The turn tiles affect actors when they are in wander mode.  Each tile forces
  87. a turn in one of the eight directions.  Again, experiment to find out which!
  88. The secret door tile is placed on the map plane in the same position as the
  89. wall in the wall plane, and makes that door secret.  The computer automagically
  90. works out in which direction the wall can be pushed.
  91. The end of game tile is only used at the end of levels 9 and 49.  These are the
  92. levels where the camera follows BJ's running jump instead of getting a DeathCam
  93. when you win.  Once the player hits the tile, he runs NORTH.  Look at levels 9
  94. and 49 to get the idea.
  95.  
  96. Actor concepts:
  97.  
  98. Actors begin either standing or walking (some are always walking).  An actor
  99. will detect your presence if you shoot when he is in earshot or if he sees you.
  100. Once he detects you it's you or him.  The standing actors just stand there, and
  101. if they are standing on a 'silent' tile then they won't hear your gun.  The
  102. walking actors walk forwards until they hit a wall or a turn tile.  Look at the
  103. maps to see how this allows you to plan complex patrols for the guards to
  104. follow.  Walking or chasing actors will open doors (including locked doors)
  105. whenever they need to.
  106.  
  107. Each actor has an initial direction (N,S,E or W) which he is facing and (if
  108. appropriate) walking.  They also have a difficulty level of 1,3 or 4.  1 means
  109. the actor appears at all difficulty levels.  3 means only on level 3 or higher,
  110. and 4 means only on 'I am death incarnate'.  The actor values on the map are
  111. grouped in 4s.  If the list below has a * to the left of the value, then
  112.  
  113. value + 0 is the item facing North
  114. value + 1 is the item facing East
  115. value + 2 is the item facing South
  116. value + 3 is the item facing West
  117.  
  118. * &6C - soldier, standing, level 1
  119. * &70 - soldier, walking, level 1
  120. * &74 - 'spion', standing, level 1
  121. * &78 - 'spion', walking, level 1
  122. * &7E - SS, standing, level 1
  123. * &82 - SS, walking, level 1
  124. * &86 - dog, standing, level 1 (this shouldn't be used)
  125. * &8A - dog, walking, level 1
  126.  
  127. Add &24 for the level 3 actors and &48 for the level 4 actors.
  128.  
  129. * &D8 - zombie, standing, level 1
  130. * &DC - zombie, walking, level 1
  131.  
  132. Add &12 for the level 3 actors and &24 for the level 4 actors.
  133.  
  134. The rest are bosses and special monsters, like the Pac-men.  These don't 'face'
  135. any direction.
  136.  
  137. &7C - the dead guard at the start of level 1
  138. &A0 - Ghost Hitler (episode 3)
  139. &B2 - Mecha-Hitler (episode 3)
  140. &B3 - Fat bastard at the end of episode 4
  141. &C4 - Dr Schabbs (the guy with the needles in episode 2)
  142. &C5 - Gretel Giftmacher, the blonde non-temptress in episode 5
  143. &D6 - Mr "Guten Tag" himself, official name Hans (episode 1)
  144. &D7 - Giftmacher, the ultimate challenge (episode 6)
  145. &E0,&E1,&E2,&E3 - Inky, Blinky, Pinky and Clyde
  146.  
  147. I've been pretty vague in some places.  I want to encourage you to experiment,
  148. all the nitty gritty is here and you need broad outlines.  The Wolfenstein 3D
  149. FAQ should help - it has tons and tons of stuff about screen designing in it.
  150.  
  151. Appendix I
  152. ----------
  153.  
  154. The following code is pretty raw, and is actually pulled straight from Arc
  155. Wolfenstein.  Exciting, huh?  The three words at the top of the program should
  156. be set up before the routine is called.  I'm afraid that recompression is left
  157. as an exercise to the reader.
  158.  
  159. .source
  160. EQUD 0                         ; This is the address of the compressed data
  161. .buffer
  162. EQUD 0                         ; This must point to a 8K buffer
  163. .target
  164. EQUD 0                         ; And this must point to the 8K output buffer
  165.    
  166.  
  167. .decompress_lump
  168. STMFD R13!,{PC}
  169. LDR R0,source                  ; set the source address
  170. LDR R1,buffer                  ; set the address of an 8K buffer
  171. BL a7a8                        ; uncompress - first stage
  172. LDR R0,buffer                  ; source = first-stage uncompressed data
  173. LDR R1,target                  ; target address
  174. BL mexpand                     ; uncompress - second stage
  175. LDMFD R13!,{PC}                ; done !
  176. .a7a8
  177. MOV R2,R1               ; dest start
  178. LDRB R8,[R0],#1
  179. LDRB R9,[R0],#1
  180. ORR R8,R8,R9,ASL #8     ; target data length (first half-word)
  181. ADD R8,R8,R2            ; end of destination buffer
  182.  
  183. .looprep1
  184. LDRB R4,[R0],#1           ; lo
  185. LDRB R5,[R0],#1           ; hi
  186. CMP R5,#&A7               
  187. BNE nota7                
  188. MOVS R4,R4,ASL #1         ; length of run
  189. BEQ special              
  190. LDRB R6,[R0],#1           ; goback1
  191. MOV R6,R6,ASL #1
  192. .loopa7
  193. LDRB R7,[R1,-R6]
  194. STRB R7,[R1],#1
  195. SUBS R4,R4,#1
  196. B
  197.  
  198.  
  199.